<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        ul {
            display: flex;
            flex-wrap: wrap;
        }

        li {
            width: 23%;
            margin: 1%;
            text-align: center;
        }

        img {
            width: 80%;
            height: 300px;
        }
    </style>
</head>

<body>

    <h1>商品列表</h1>

    <ul>
        <!-- <li>
            <a href="">
                <img src="" alt="">
                <h3></h3>
                <p></p>
                <strong></strong>
            </a>
        </li> -->
    </ul>


    <script src="../../js/ajax_v2.js"></script>
    <!-- <script src="../js/tools.js"></script> -->
    <script>

        fn()

        async function fn() {
            const res = await ajax({
                type: 'get',
                url: 'http://121.43.116.41/php/list.php',

            })

            console.log(res);

            const arr = res.data;

            let html = '';
            arr.forEach(item => {
                html += `
                <li>
                    <a href="./06_detail.html?yy=${item.goods_id}">
                        <img src="${item.goods_img}" alt="">
                        <h3>${item.goods_title}</h3>
                        <p>${item.goods_des}</p>
                        <strong>${item.goods_price}</strong>
                    </a>
                </li>
                `
            })

            $('ul').innerHTML = html;
        }





    </script>

</body>

</html>